package school.entity;

/**
 * 课程基础类：存储课程信息，提供toString()格式化输出
 */
public class Course {
    // 私有属性：课程核心信息
    private String courseId;
    private String courseName;
    private String location;
    private String time;
    private String teacherId; // 关联授课教师的ID

    // 构造方法：初始化课程的基础信息（不含teacherId，由教师开课时设置）
    public Course(String courseId, String courseName, String location, String time) {
        this.courseId = courseId;
        this.courseName = courseName;
        this.location = location;
        this.time = time;
    }

    // 覆写toString()：格式化课程信息输出，使对象可以被格式化输出属性。
    @Override
    public String toString() {
        return "课程编号：" + courseId + "，课程名称：" + courseName + 
               "，上课地点：" + location + "，上课时间：" + time;
    }

    // Getter和Setter方法：public修饰，允许跨包访问和修改
    public String getCourseId() {
        return courseId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(String teacherId) {
        this.teacherId = teacherId;
    }
}